//
//  MVTableViewCell.m
//  MusicMV
//
//  Created by Eternity on 16/3/17.
//  Copyright © 2016年 Eternity. All rights reserved.
//

#import "MVTableViewCell.h"

@interface MVTableViewCell ()



@end

@implementation MVTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
    }
    return self;
}

- (void)create {
    self.MVImage = [[UIImageView alloc] init];
    [self.contentView addSubview:_MVImage];
    _MVImage.backgroundColor = [UIColor blackColor];
    self.titleLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_titleLabel];
    self.artistNameLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_artistNameLabel];
    self.totolViewsLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_totolViewsLabel];

    [_MVImage mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.top.right.bottom.offset(0);
        
    }];
    
    
    
    
    [_MVImage mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.top.offset(0);
        make.right.bottom.offset(0);
        
    }];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.offset(10 * wt);
        make.bottom.offset(-(55 * ht));
        make.width.mas_equalTo(200 * wt);
        make.height.mas_equalTo(25 * ht);
    }];
    _titleLabel.textColor = [UIColor yellowColor];
    [_artistNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
    make.left.with.offset(10 * wt);
    make.bottom.offset(-(30 * ht));
    make.width.mas_equalTo(150 * wt);
    make.height.mas_equalTo(25 * ht);
    }];
    _artistNameLabel.textColor = RGBA(30, 160, 130, 1);
    
    [_totolViewsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.with.offset(10 * wt);
        make.bottom.offset(-(5 * ht));
        make.width.mas_equalTo(150 * wt);
        make.height.mas_equalTo(25 * ht);
    }];
    
    _totolViewsLabel.textColor = [UIColor orangeColor];
    _totolViewsLabel.font = [UIFont systemFontOfSize:13];
}

- (void)setMvModel:(MusicVideoModel *)mvModel {
    _mvModel = mvModel;
    _titleLabel.text = _mvModel.title;
    _artistNameLabel.text = _mvModel.artistName;
    _totolViewsLabel.text =[NSString stringWithFormat:@"播放次数:%@",_mvModel.totalViews ];
    [_MVImage sd_setImageWithURL:[NSURL URLWithString:_mvModel.albumImg] placeholderImage:[UIImage imageNamed:PLACE_HLODER]];

}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
